package woaini.fenger.core.utils;

import cn.hutool.core.io.resource.ClassPathResource;
import cn.langpy.nlp2cron.CrondUtil;
import cn.langpy.nlp2cron.core.CrondModel;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;

/**
 * Cron实用程序
 *
 * @see woaini.fenger.core.utils.CronUtils
 * @author yefeng {@code @Date} 2023-05-16 16:50:39
 */
@UtilityClass
@Slf4j
public class CronUtils {

    static {
        ClassPathResource classPathResource = new ClassPathResource("/model/keras-model-v2");
        String absolutePath = classPathResource.getAbsolutePath();
        CrondModel.init(absolutePath);
    }

    public String getCron(String text) {
        return CrondUtil.toCron(text);
    }
}
